var express = require('express');
var router = express.Router();
const {getAll2,delete2,addOne2,updateOne2}=require("../server/goodsTypeServer");
/* GET users listing. */

// 生成所有商品分类
router.get('/',async function(req, res, next) {
    // 获取service里数据 传命令参数
    const resBack=await getAll2(req.body);
    res.send(resBack);
  });
// 删除
  router.delete('/',async function(req, res, next) {
    // 获取service里数据 传命令参数
    console.log(req.body);
    const resBack=await delete2(req.body);
    res.send(resBack);
  });
// 新增
router.post('/',async function(req, res, next) {
  // 获取service里数据 传命令参数
  console.log(req.body);
  const resBack=await addOne2(req.body);
  res.send(resBack);
});
// 修改
router.put('/',async function(req, res, next) {
  // 获取service里数据 传命令参数
  console.log(req.body);
  const resBack=await updateOne2(req.body);
  res.send(resBack);
});
module.exports = router;